package com.example.schoolguider.service;

import com.example.schoolguider.model.User;
import com.example.schoolguider.util.JWTUtil;
import org.springframework.stereotype.Service;

import java.util.HashMap;

/**
 * @author wjc
 * @date 2024/6/29 10:09
 */
@Service
public class UserService {
    public HashMap login(User user) {
        HashMap<String, Object> map = new HashMap<>();
        if (user.getUserName().equals("admin") && user.getPassword().equals("admin")) {
            map.put("token_type","Bearer");
            map.put("access_token", JWTUtil.createJwt(user));
        } else {
            map.put("msg", "登录失败");
        }
        return map;
    }
}
